package com.jwell.panrank.ui.adapter

import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.jwell.panrank.R
import com.jwell.panrank.entity.CarInquireBean
import com.jwell.panrank.entity.CarNumberBean
import kotlinx.android.synthetic.main.item_car_inquire_layout.view.*

/**
 * Created by 76577 on 2018/6/20.
 * 车辆查询
 */
class CarNumberAdapter constructor(list: List<CarNumberBean>) : RecyclerView.Adapter<CarNumberAdapter.ViewHolder>() {
    private var list = list

    override fun getItemCount(): Int {
        return list.size
    }
    

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_car_inquire_layout, parent, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        with(holder.itemView) {
            text1.text = list[position].parkNo+list[position].mtrlClassMain?: ""
            text2.text = list[position].maxVehicleNum.toString()
            text3.text = list[position].curCount.toString()
            text4.text = list[position].surplusCount.toString()
        }
    }

    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
}